﻿#region Copyright(c) 2006 ZO, All right reserved.
// -----------------------------------------------------------------------------
// Copyright(c) 2006 ZO, All right reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
//   1.  Redistribution of source code must retain the above copyright notice,
//       this list of conditions and the following disclaimer.
//   2.  Redistribution in binary form must reproduce the above copyright
//       notice, this list of conditions and the following disclaimer in the
//       documentation and/or other materials provided with the distribution.
//   3.  The name of the author may not be used to endorse or promote products
//       derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// -----------------------------------------------------------------------------
#endregion


#region Using directives

using System.ComponentModel;

#endregion

namespace ZO.SmartCore.Protocols.XMPP.Protocol.Common
{
    /// <summary>
    /// Error codes to add to XMPP-style errors
    /// </summary>
    public enum StanzaErrorCode
    {
        /// <summary>
        /// No Error
        /// </summary>
        None = 0,

        /// <summary>
        /// The sender has sent XML that is malformed or that cannot be processed 
        /// (e.g., an IQ stanza that includes an unrecognized value of the 'type' attribute); 
        /// the associated error type SHOULD be "modify".
        /// </summary>
        [Description("bad-request")]
        BadRequest = 400,

        /// <summary>
        /// Access cannot be granted because an existing resource or session exists with 
        /// the same name or address; the associated error type SHOULD be "cancel".
        /// </summary>
        [Description("conflict")]
        Conflict = 409,


        /// <summary>
        /// The feature requested is not implemented by the recipient or server and therefore cannot be processed; 
        /// the associated error type SHOULD be "cancel".
        /// </summary>
        [Description("feature-not-implemented")]
        NotImplemented = 501,

        /// <summary>
        /// The requesting entity does not possess the required permissions to perform the action;
        /// the associated error type SHOULD be "auth".
        /// </summary>
        [Description("forbidden")]
        Forbidden = 403,

        /// <summary>
        /// The server could not process the stanza because of a misconfiguration or an 
        /// otherwise-undefined internal server error; the associated error type SHOULD be "wait".
        /// </summary>
        [Description("internal-server-error")]
        InternalServerError = 500,


        /// <summary>
        /// The addressed JID or item requested cannot be found; 
        /// the associated error type SHOULD be "cancel".
        /// </summary>
        [Description("item-not-found")]
        NotFound = 404,


        /// <summary>
        /// The recipient or server understands the request but is refusing to process it
        /// because it does not meet criteria defined by the recipient or server 
        /// (e.g., a local policy regarding acceptable words in messages); 
        /// the associated error type SHOULD be "modify".
        /// </summary>
        [Description("not-acceptable")]
        NotAcceptable = 406,


        /// <summary>
        /// The recipient or server does not allow any entity to perform the action; 
        /// the associated error type SHOULD be "cancel".
        /// </summary>
        [Description("not-allowed")]
        NotAllowed = 405,


        /// <summary>
        /// The sender must provide proper credentials before being allowed to perform the action, 
        /// or has provided improper credentials; the associated error type SHOULD be "auth".
        /// </summary>
        [Description("not-authorized")]
        NotAuthorized = 401,


        /// <summary>
        /// The requesting entity is not authorized to access the requested service 
        /// because payment is required; the associated error type SHOULD be "auth".
        /// </summary>
        [Description("payment-required")]
        PaymentRequired = 402,


        /// <summary>
        /// The recipient or server is redirecting requests for this information to another entity,
        /// usually temporarily (the error stanza SHOULD contain the alternate address, 
        /// which MUST be a valid JID, in the XML character data of the <redirect/> element); the associated error type SHOULD be "modify".
        /// </summary>
        [Description("redirect")]
        Redirect = 302,


        /// <summary>
        ///  The requesting entity is not authorized to access the requested service 
        /// because registration is required; the associated error type SHOULD be "auth".
        /// </summary>
        [Description("registration-required")]
        RegistrationRequired = 407,



        /// <summary>
        /// A remote server or service specified as part or all of the JID of the intended 
        /// recipient (or required to fulfill a request) could not be contacted within a 
        /// reasonable amount of time; the associated error type SHOULD be "wait".
        /// </summary>
        [Description("remote-server-timeout")]
        RemoteServerTimeout = 504,


        /// <summary>
        /// the server or recipient does not currently provide the requested service; 
        /// the associated error type SHOULD be "cancel".
        /// </summary>
        [Description("service-unavailable")]
        ServiceUnavailable = 503,


        /// <summary>
        /// the server or recipient does not currently provide the requested service; 
        /// the associated error type SHOULD be "cancel".
        /// </summary>
        [Description("service-unavailable")]
        Disconnected = 510,

        /// <summary>
        /// the server or recipient does not currently provide the requested service; 
        /// the associated error type SHOULD be "wait".
        /// </summary>
        [Description("service-unavailable")]
        RemoteServerError = 502,

        /// <summary>
        /// A remote server or service specified as part or all of the JID of the intended 
        /// recipient (or required to fulfill a request) could not be contacted within a 
        /// reasonable amount of time; the associated error type SHOULD be "wait".
        /// </summary>
        [Description("remote-server-timeout")]
        RequestTimeout = 408
    }
}
